package com.googlecode.imanager.client.io;

import java.util.Map;

import com.googlecode.imanager.client.Control;

/**
 * @author wellsantos@wellsantos.com
 * @since 0.01
 */
public class HttpRequest {

    private Path path;
    private String method;
    private RequestType type;
    private Control rootControl;
    private Map<String, Object> params;
    
    public HttpRequest(Path path, String method, RequestType type,
            Control rootControl, Map<String, Object> params) {
        this.path = path;
        this.method = method;
        this.type = type;
        this.rootControl = rootControl;
        this.params = params;
    }

    public void onSuccess(Object result){
    }
    
    public void onFailure(Throwable e){
    }
    
    
    public Path getPath() {
        return path;
    }

    public String getMethod() {
        return method;
    }

    public RequestType getType() {
        return type;
    }

    public Control getRootControl() {
        return rootControl;
    }

    public Map<String, Object> getParams() {
        return params;
    }


    public static enum RequestType {
        AJAX,
        SJAX, // FIXME maybe not supported
        SUBMIT,
        BLANK_PAGE
    }
    
}
